import { getDept } from "@/api/system/dept";

const state = {
  focusInput: "",
  page: 0,
  value: "",
  printEmpty: false
};
const mutations = {
  CHANGE_FOCUS: (state, data) => {
    for (const key in data) {
      if (Object.hasOwnProperty.call(data, key) && state.hasOwnProperty(key)) {
        state[key] = data[key];
      }
    }
    // state.focusInput = value;
  },
  CHANGE_PRINT_EMPTY: (state, value) => {
    state.printEmpty = value;
  },
  SET_EMPTY_INFO: (state, data) => {
    state.emptyInfo = data;
  }
};

const actions = {
  // 修改聚焦
  changeFocus({ commit }, data) {
    commit("CHANGE_FOCUS", data);
  },
  // 修改是否打印空表
  printEmptyChange({ commit }, data = false) {
    commit("CHANGE_PRINT_EMPTY", data);
  }
  // 获取空表默认值
  // getEmptyInfo({ commit }, deptId) {
  //   getDept(deptId).then((res) => {
  //     const data = res.data;
  //     commit("SET_EMPTY_INFO", data);
  //   });
  // }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
